import java.util.Scanner;

public class 线段树 {
    static int N = 100010;
    static Node[] tree = new Node[N*4];
    static int[] arr = new int[N];
    public static void main(String[] args) {
        Scanner s  = new Scanner(System.in);
        int n = s.nextInt();int m = s.nextInt();
        for(int i=1;i<=n;i++) arr[i] = s.nextInt();
        //for (int i=0;i<tree.length;i++) tree[i] = new Node();
        build(1,1,n);

        while(m-- >0) {
            int k = s.nextInt();int a = s.nextInt();int b = s.nextInt();
            if(k==1) modify(1,a,b);
            else System.out.println(query(1, a, b));
        }
    }

    private static int query(int u,int l,int r) {

        if(l<=tree[u].l && r>=tree[u].r) return tree[u].sum;
        int sum=0;
        int mid = tree[u].l+tree[u].r>>1;
        if(mid>=l) sum+=query(u<<1,l,r);
        if(mid<r) sum+=query(u<<1 | 1,l,r);

        return sum;
    }
    private static void modify(int u,int x,int v) {
        if( tree[u].r == tree[u].l) tree[u].sum+=v;
        else {
            int mid = tree[u].l+tree[u].r >>1;
            if(x<=mid) modify(u<<1,x,v);
            else modify(u<<1 | 1,x,v);
            pushUp(u);
        }
    }

    private static void pushUp(int u) { //利用子节点，更新当前结点
        tree[u].sum = tree[u<<1].sum+tree[u<<1 | 1].sum;
    }
    private static void build(int u,int l,int r) { //在一段区间内初始化线段树
        if(l==r) {
            tree[u] = new Node(l,r,arr[r]);
        }
        else {
            tree[u] = new Node(l,r,0);
            int mid = l+r >>1;
            build(u<<1,l,mid); build(u<<1 | 1,mid+1,r);
            pushUp(u);
        }
    }

}
class Node {
    int l;
    int r;
    int sum;
    public Node() {}
    public Node(int l,int r,int sum) {
        this.l = l;
        this.r = r;
        this.sum = sum;
    }
}
